<?php
include_once "test2.php";
$popsize=50;
$matkul=35;
$jadwal=30;
$pc=0.08;
$pm=0.08;
$gen=400;
$gens=1;


//for (;$gens<=$gen;$gens++){
echo "Generasi ke-";echo $gens."<br/>";
/*===========================================================================
Pembangkitan Generasi + Fitness.....
//===========================================================================*/
echo "<table border='1' style='text-align:center;'>";
echo "<tr><td></td>";
for ($a=1;$a<=$matkul;$a++)				//++
{
echo "<td>".$a."</td>";
}
echo "<td>fitness</td></tr>";		//++
for ($a=1;$a<=$popsize;$a++)
{
echo "<tr><td>Individu-".$a."</td>";				//
	for ($b=1;$b<=$matkul;$b++)
	{
		echo "<td>";									//
		$ggg[$b]=$kromosom[$a][$b]= rand(1,$jadwal);
		echo $ggg[$b]."</td>";							//
	}
$fit_sum[$a]=quickCount($ggg);
$fit_av=$fit_av + $fit_sum[$a];
echo "<td>".$fit_sum[$a]."</td>";			//
echo "</tr>";								//
}

$fit_gbest[$gens]=$fit_min=max($fit_sum);
$fit_gbwhere[$gens]=$fit_where=inWhere($fit_sum, $fit_min);
$fit_gaverage[$gens]=$fit_av2=round(($fit_av/$popsize), 5);
echo "<tr><td>".$fit_min."</td>"."<td>".$fit_where."</td><td>".$fit_av2."</td></tr>";
echo "</table><br/>";
/*===========================================================================
Proses Seleksi "Good Fitness".....
===========================================================================*/




/*
}
echo "<br/><br/><br/>";
$fit_gbest_fin=max($fit_gbest);
$fit_gbwhere_fin=inWhere($fit_gbest, $fit_gbest_fin);
$fit_gbwhere_fin2=$fit_gbwhere[$fit_gbwhere_fin];
$fit_gaverage_fin=(array_sum($fit_gbest))/$gen;
echo $fit_gbest_fin.";".$fit_gbwhere_fin."-".$fit_gbwhere_fin2.";".$fit_gaverage_fin;
*/
?>